#import <Foundation/Foundation.h>
#import "Atom.h"
#import "Animal.h"
#import "People.h"
#import "Mouse.h"
#import "Customer.h"
#import "Restaurant.h"

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        /* Atom * atom = [[Atom alloc] init];
         NSLog(@"Atom chemical element name: %@",atom.chemicalElement);
         NSLog(@"Atom chemical element name: %@",[atom chemicalElement]);
         
         */
        Animal * ani=[[Animal alloc]init];
        ani.name=@"动物类";
        
        People * p=[[People alloc]init];
        
        p.name=@"Jerry";
        /*
         Animal *ani=p;
         [ani eat];
         [ani sleep];
         
         [p eat];
         [p sleep];
         [p talk:@"是的"];
         */
        Mouse * m=[[Mouse alloc]init];
        m.name=@"杰瑞鼠";
        
        
        /*
         NSArray *arr=@[p,m];
         for(int i=0;i<arr.count;i++){
         Animal * ani=arr[i];
         [ani eat];
         [ani sleep];
         }
         */
        NSArray * arr=@[ani,p,m];
        NSLog(@"names: %@",[arr componentsJoinedByString:@"--"]);
        
        /*
         NSString * str=@"Tom..and..Jerry..猫和老鼠";
         NSArray * ano=[str componentsSeparatedByString:@".."];
         //componentsSeparatedByString:@".."里的分隔符要和@"Tom..and..Jerry..猫和老鼠"里的分隔符一样
         for(int i=0;i<ano.count;i++)
         {
         NSString *s=ano[i];
         NSLog(@"%d,%@",i,s);
         }
         */
        
        
        /*
        NSString *str=@"e,c,f,b";
        NSArray *ano=[str componentsSeparatedByString:@","];
        ano =[ano sortedArrayUsingSelector:@selector(compare:)];
        for(int i=0;i<ano.count;i++)
        {
            NSString *s=ano[i];
            NSLog(@"%d,%@",i,s);
        }
        NSLog(@"\n");
        
        NSArray * number=@[@(5),@(7),@(2),@(9)];
        number =[number sortedArrayUsingSelector:@selector(compare:)];
        for(int i=0;i<number.count;i++)
        {
            NSString *s=number[i];
            NSLog(@"%d,%@",i,s);
        }
        */
        
        Restaurant *resto=[[Restaurant alloc]init];
        Customer *cust=[[Customer alloc]init];
        cust.delegate =resto;
        [cust comeToRestaurant];
        
    }
    
    return 0;
}
